package com.lizhao.ai.impl.condition;

import com.lizhao.ai.common.EStatus;
import com.lizhao.ai.abs.BaseCondition;
import com.lizhao.ai.ifs.IBehaviour;

/**
 * 看见敌人的条件节点（读节点）
 */
public class ConditionIsSeeEnemy extends BaseCondition {

    @Override
    public EStatus update() {
        EStatus eStatus = null;
        String msg = "";
        int random = getRandom();
        if (random < 50) {
            msg = "SeeEnemy";
            eStatus = !isNegation() ? EStatus.Success : EStatus.Failure;
        } else {
            msg = "Not SeeEnemy";
            eStatus = !isNegation() ? EStatus.Failure : EStatus.Success;
        }
        System.out.println("看见怪物条件节点：ConditionIsSeeEnemy " + msg + " - " + eStatus);
        return eStatus;
    }

    @Override
    public void addChild(IBehaviour child) {
    }
}
